package com.niubility.server.Impl;

import com.niubility.dao.CheckAriticDao;
import com.niubility.entity.Article;
import com.niubility.server.ICheckArticleServer;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service("checkArticleServer")
@Transactional
public class CheckArticleServer implements ICheckArticleServer{

    @Resource
    private CheckAriticDao checkAriticDao;

    public List<Article> LoadAll(int start,int num){
        return checkAriticDao.LoadAll(start,num);
    }

    public boolean Save(Article dep) {
        return checkAriticDao.Save(dep) > 0?true:false;
    }

    public boolean Delete(int masterid,String title) {
        return checkAriticDao.Delete(masterid,title)>0?true:false;
    }

    public Article select(int masterid,String title) {
        return checkAriticDao.Select(masterid,title).get(0);
    }

    public int PageNum(int num){
        return  checkAriticDao.PageNum(num)%num == 0?checkAriticDao.PageNum(num)/num:checkAriticDao.PageNum(num)/num+1;
    }
}
